import request from '@/utils/request'

export default {
    getUserList(searchModel) {
        return request({
            url: "/user/list",
            method: "get",
            params: searchModel
        })
    },
    addUser(user) {
        return request({
            url: "/user/adduser",
            method: "post",
            data: user
        })
    },
    saveUser(user) {
        if (user.id == null || user.id == undefined) {
            return this.addUser(user)
        }
        return this.updateUser(user)
    },
    updateUser(user) {
        return request({
            url: '/user/updateuser',
            method: "put",
            data: user
        })
    },
    getUserById(id) {
        return request({
            url: `/user/getuser/${id}`,
            method: "get",
        })
    },
    deleteUserById(id) {
        return request({
            url: `/user/deleteuser/${id}`,
            method: "delete",
        })
    },
}